/**
 * LEKU APPLIANCE CHAINS.
 * Copyright (c) 2016-2016 All Rights Reserved.
 */
package com.leku.video.dao.impl.home;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.leku.commons.datasource.DataSourceClient;
import com.leku.video.dao.home.HomeDao;
import com.leku.video.dto.result.home.JdkDto;
import com.leku.video.dto.result.home.JsDto;
import com.leku.video.dto.result.home.KvDto;

/**
 * 功能描述: 键值对、js获取服务
 *
 * @author Ranphy
 * @created 2018年10月26日
 * @version 1.0.0
 */
@Repository
public class HomeDaoImpl implements HomeDao {

	@Autowired
	private DataSourceClient dataSourceClient;

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.leku.video.dao.home.HomeDao#findJs(java.lang.String)
	 */
	@Override
	public JsDto findJs(String os) {
		Map<String, Object> param = new HashMap<String, Object>();

		param.put("os", os);

		return dataSourceClient.selectOne("homeDao.findJs", param);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.leku.video.dao.home.HomeDao#findJdk(java.lang.String)
	 */
	@Override
	public JdkDto findJdk(String os) {

		Map<String, Object> param = new HashMap<String, Object>();

		param.put("os", os);

		return dataSourceClient.selectOne("homeDao.findJdk", param);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.leku.video.dao.home.HomeDao#findKv(java.lang.String,
	 * java.lang.String, java.lang.String, java.lang.String)
	 */
	@Override
	public KvDto findKv(String os, String pkgname, String channel, String version) {

		Map<String, Object> param = new HashMap<String, Object>();

		param.put("os", os);
		param.put("pkgname", pkgname);
		param.put("channel", channel);
		param.put("version", version);

		return dataSourceClient.selectOne("homeDao.findKv", param);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.leku.video.dao.home.HomeDao#findYSKv(java.lang.String,
	 * java.lang.String, java.lang.String, java.lang.String, java.lang.String)
	 */
	@Override
	public String findYSKv(String os, String pkgname, String channel, String version, String key) {

		Map<String, Object> param = new HashMap<String, Object>();

		param.put("os", os);
		param.put("pkgname", pkgname);
		param.put("channel", channel);
		param.put("version", version);
		param.put("key", key);

		return dataSourceClient.selectOne("homeDao.findYSKv", param);
	}

}
